import java.io.File;
import java.io.FilenameFilter;

// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
    public static void main(String[] args) {
        File f1 =new File("src","Main.java");
        File f2 =new File("src","Main2.java");
        System.out.println(f1.getAbsoluteFile());
        System.out.println(f2.getAbsoluteFile());
        System.out.println(f1.canRead());
        System.out.println(f2.canRead());
        System.out.println(f1.length());
        System.out.println(f2.length());
        File file = new File("new.txt");
        if(file.exists()){
            System.out.println("文件存在");
        }else{
            System.out.println("文件不存在");
        }
        System.out.println("判断是否目录:" +f1.isDirectory());
        boolean dir = f1.mkdir();
        if(dir){
            System.out.println(f1.getName());
        }
        File javaDir = new File("java");
        boolean dir2 = javaDir.mkdir();
        if(dir2){
            System.out.println(javaDir.getName());
        }
        String[] fileNames = javaDir.list();
        for(String name : fileNames){
            System.out.println(name);
        }
        System.out.println("-----------------");
        FileAccept fileAccept = new FileAccept();
        String[] fileNamesWithFilter = javaDir.list(fileAccept);
        for(String name : fileNamesWithFilter){
            System.out.println(name);
        }
    }
}